﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using PBDesk.Framework.LogNExp.Logger;

namespace PBDesk.Framework.LogNExp
{
    public class LogMgr
    {
        public static void WriteStats(string message)
        {
            WriteLog(LevelOfLog.Info, LogType.Stat, message);
        }
        public static void  WriteTrace(string message)
        {
            WriteLog(LevelOfLog.Trace, LogType.Trace, message);
        }

        public static void WriteError(string message)
        {
            WriteLog(LevelOfLog.Error, LogType.Error, message);
        }

        public static void WriteInfo(string message)
        {
            WriteLog(LevelOfLog.Info, LogType.Info, message);
        }

        public static void WriteLog(LevelOfLog level, LogType type, string message)
        {
            NLog.Logger logger = null;
            switch (type)
            {
                case LogType.Trace:
                    {
                        logger = LogManager.GetLogger("TraceLogger");
                        break;
                    }
                case LogType.Stat:
                    {
                        logger = LogManager.GetLogger("StatLogger");
                        break;
                    }
                case LogType.Error:
                    {
                        logger = LogManager.GetLogger("ErrorLogger");
                        break;
                    }
                case LogType.Info:
                    {
                        logger = LogManager.GetLogger("TraceLogger");
                        break;
                    }


            }

            switch (level)
            {
                case LevelOfLog.Trace:
                    {
                        logger.Trace(message);
                        break;
                    }
                case LevelOfLog.Error:
                    {
                        logger.Error(message);
                        break;
                    }
                case LevelOfLog.Fatal:
                    {
                        logger.Fatal(message);
                        break;
                    }
                case LevelOfLog.Info:
                    {
                        logger.Info(message);
                        break;
                    }

            }

          
            
        }


    }
}
